@@ -299,14 +299,14 @@ module Agents |
||
| 299 | 299 |
end).to_s |
| 300 | 300 |
end |
| 301 | 301 |
|
| 302 |
- def extract_each(doc, &block) |
|
| 302 |
+ def extract_each(&block) |
|
| 303 | 303 |
interpolated['extract'].each_with_object({}) { |(name, extraction_details), output|
|
| 304 | 304 |
output[name] = block.call(extraction_details) |
| 305 | 305 |
} |
| 306 | 306 |
end |
| 307 | 307 |
|
| 308 | 308 |
def extract_json(doc) |
| 309 |
- extract_each(doc) { |extraction_details|
|
|
| 309 |
+ extract_each { |extraction_details|
|
|
| 310 | 310 |
result = Utils.values_at(doc, extraction_details['path']) |
| 311 | 311 |
log "Extracting #{extraction_type} at #{extraction_details['path']}: #{result}"
|
| 312 | 312 |
result |
@@ -314,7 +314,7 @@ module Agents |
||
| 314 | 314 |
end |
| 315 | 315 |
|
| 316 | 316 |
def extract_text(doc) |
| 317 |
- extract_each(doc) { |extraction_details|
|
|
| 317 |
+ extract_each { |extraction_details|
|
|
| 318 | 318 |
regexp = Regexp.new(extraction_details['regexp']) |
| 319 | 319 |
result = [] |
| 320 | 320 |
doc.scan(regexp) {
|
@@ -326,7 +326,7 @@ module Agents |
||
| 326 | 326 |
end |
| 327 | 327 |
|
| 328 | 328 |
def extract_xml(doc) |
| 329 |
- extract_each(doc) { |extraction_details|
|
|
| 329 |
+ extract_each { |extraction_details|
|
|
| 330 | 330 |
case |
| 331 | 331 |
when css = extraction_details['css'] |
| 332 | 332 |
nodes = doc.css(css) |